package com.zoroki.hmusic.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serial;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * <p>
 *
 * </p>
 *
 * @author zoroki
 * @since 2023-05-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("song")
@Document(indexName = "song")
public class Song implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 歌曲id
     */

    @TableId(value = "id", type = IdType.AUTO)
    @Id
    @Field(type = FieldType.Text)
    private Integer id;

    /**
     * 歌曲名称
     */
    @Field(analyzer = "ik_max_word")
    private String name;

    /**
     * 歌手
     */
    @Field(analyzer = "ik_max_word")
    private String singer;

    /**
     * 作词者名称
     */
    @Field(analyzer = "ik_max_word")
    private String lyricist;

    /**
     * 作曲者名称
     */
    @Field(analyzer = "ik_max_word")
    private String composer;

    /**
     * 备注
     */
    @Field(analyzer = "ik_max_word")
    private String remark;

    /**
     * 用户id：指上传此歌曲的用户
     */
    private Integer userId;

    /**
     * 歌词id
     */
    private Integer lyricsId;

    /**
     * 歌曲的url地址
     */
    private String url;

    /**
     * 创建时间
     */
//    @Field(type = FieldType.Date,format = DateFormat.basic_ordinal_date_time)
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second,pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime createdAt;

    /**
     * 更新日期
     */
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second,pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime updatedAt;

}
